<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<?php
    if(isset($_REQUEST['btnConfirmPettyCash']))
    {
        $Date = $_REQUEST['txtDate'];
        $cashAmount = $_REQUEST['txtCashAmount'];
        $purpose = $_REQUEST['cmbPurpose'];
        $notes = $_REQUEST['txtNotes'];
        
        require 'lib/util.php';
        
        $sql = "CALL sp_AddPettyCashEntry('" . $Date . "', '" . $cashAmount . "', '" . $purpose . "', '" . $notes . "', 1)";
        $rs = executeSqlQuery($sql);
    }
?>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <?php
        // This place is reserved to set the purpose options
            $purposeItems [0]= "Weekly Expenses";
            $purposeItems [1]= "Special";
        ?>
    </head>
    <body>
        <?php
        // put your code here
        ?>
        <form action="finPettyCash.php" method="get">
            <table width="75%" border="1" cellspacing="2" cellpadding="2">
  <tr>
    <td>Date</td>
    <td><label>
            <input type="text" name="txtDate" id="txtDate" value="<?php echo date("Y-m-d"); ?>">
    </label></td>
  </tr>
  <tr>
    <td>Petty Cash Amount</td>
    <td><label>
      <input type="text" name="txtCashAmount" id="txtCashAmount">
    </label></td>
  </tr>
  <tr>
    <td>Purpose</td>
    <td><label>
      <select name="cmbPurpose" id="cmbPurpose">
          <?php
            for ($i = 0; $i < count($purposeItems); $i++)
            {
                echo "<option>" . $purposeItems[$i] . "</option>";
            }
          ?>
      </select>
    </label></td>
  </tr>
  <tr>
    <td>Notes</td>
    <td><label>
      <textarea name="txtNotes" id="txtNotes" cols="45" rows="5"></textarea>
    </label></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><label>
      <input type="submit" name="btnConfirmPettyCash" id="btnConfirmPettyCash" value="Submit">
    </label></td>
  </tr>
</table>
</form>
    </body>
</html>
